package com.ruoyi.operation.order.shop.service.impl;

import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.operation.order.shop.domain.Shop;
import com.ruoyi.operation.order.shop.mapper.IShopMapper;
import com.ruoyi.operation.order.shop.service.IShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author king
 * @create 2019/4/16 14:20
 */

@Service
public class ShopServiceImpl implements IShopService {


    @Autowired
    private IShopMapper iShopMapper;

    /**
     * 新增商铺信息
     * @param shop
     * @return
     */
    @Override
    public int saveShop(Shop shop) {
        shop.setCreateBy(ShiroUtils.getLoginId());
        shop.setIsDel("1");
        return iShopMapper.saveShop(shop);
    }


    /**
     * 查询所有的店铺信息
     * @param shop
     * @return
     */
    @Override
    public List<Shop> allShopList(Shop shop) {
        return iShopMapper.allShopList(shop);
    }

    /**
     * 根据id查询对应的shop对象
     * @param id
     * @return
     */
    @Override
    public Shop findById(String id) {
        return iShopMapper.findById(id);
    }

    /**
     * 编辑店铺信息
     * @param shop
     * @return
     */
    @Override
    public int editShop(Shop shop) {
        shop.setUpdateBy(ShiroUtils.getLoginId());
        return iShopMapper.editShop(shop);
    }

    /**
     * 删除店铺信息
     * @param id
     * @return
     */
    @Override
    public int delShop(String id) {
        return iShopMapper.delShop(id);
    }

    @Override
    public List<Shop> selectByDeptId(String id) {
        return iShopMapper.selectByDeptId(id);
    }
}
